package com.segersten.astro;

import java.io.Serializable;

class Key implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3L;
	
	private final long generation;
	private final String signId;
	private final int month;
	private final String language;
	
	
	public Key() {
	}
	public Key(String signId, int month, String language) {
		super();
		this.signId = signId;
		this.month = month;
		this.language = language;
		this.generation = serialVersionUID;
	}
	public String getSignId() {
		return signId;
	}
	public int getMonth() {
		return month;
	}
	public String getLanguage() {
		return language;
	}
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (generation ^ (generation >>> 32));
		result = prime * result
				+ ((language == null) ? 0 : language.hashCode());
		result = prime * result + month;
		result = prime * result + ((signId == null) ? 0 : signId.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Key other = (Key) obj;
		if (generation != other.generation)
			return false;
		if (language == null) {
			if (other.language != null)
				return false;
		} else if (!language.equals(other.language))
			return false;
		if (month != other.month)
			return false;
		if (signId == null) {
			if (other.signId != null)
				return false;
		} else if (!signId.equals(other.signId))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return String.format("%s%s%s", signId,language,month);
	}
	
	
	
}
